
#ifndef _DYNAMICARRAY_H
#define _DYNAMICARRAY_H


#include <vector>
using namespace std;


template <typename T>


class DynamicArray
{
public:
    DynamicArray(){};

    DynamicArray(int rows, int cols): dArray(rows, vector<T>(cols)){}

    vector<T> & operator[](int i) 
    { 
		if(i < dArray.size()-1)
		{
			return dArray[i];
		}
		//cout << "Input too big for array...\n";
		//system("PAUSE");
		return dArray[0];
    }



    const vector<T> & operator[] (int i) const 
    { 
      if(i < dArray.size()-1)
		{
			return dArray[i];
		}
		cout << "Input too big for array...\n";
		return dArray[0];
    }


    void resize(int rows, int cols)//resize the two dimentional array .
    {
        dArray.resize(rows);
        for(int i = 0; i < rows;++i) dArray[i].resize(cols);
    }
private:
    vector<vector<T> > dArray;  
};



#endif